<?php
class Group extends AppModel {

	var $name = 'Group';

	//The Associations below have been created with all possible keys, those that are not needed can be removed
	var $hasMany = array(
		'User' => array(
			'className' => 'User',
			'foreignKey' => 'group_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		)
	);
	
/*
 * Returns the group id of the admins group
 * @return int the id of the admins group
*/
	function getAdminsGroupId(){
		$this->unbindModel(array('hasMany' => array('User')));
		$id = $this->find('first',
											 array(
												'conditions' => array('Group.name' => 'admins'),
												'fields' => 'id',
												'recursive => -1'
												));
		if($id['Group']['id'])
			return $id['Group']['id'];
		else
			return false;
	}


}
?>